
public class Weapon {
	
	private Ship owner;
	
	private Projectile[] p;
	private int ammunition;
	private long frequencyCap; // how often a missile can be fired
	
	public Weapon(Ship cowner, Projectile[] cp, int cammunition, long cfrequencyCap){
		owner = cowner;
		p = cp;
		ammunition = cammunition;
		frequencyCap = cfrequencyCap;
	}
	
	public void fire(){} // spawns the projectile array
	
	public Ship getOwner(){return owner;}
	public Projectile[] getProjectileArray(){return p;}
	public Projectile getProjectileAt(int gpa){
		if(p != null)
		{
			if((gpa >= 0) && (gpa < p.length))
			{
				return p[gpa];
			}
		}
		return null;
	}
	public int getAmmunition(){return ammunition;} // -1 shall be infinite
	public long getFrequencyCap(){return frequencyCap;}
	
	public void setOwner(Ship so){owner = so;}
	public void setProjectileArray(Projectile[] spa){p = spa;}
	public void setProjectileAt(Projectile sp, int spi){
		if(p != null)
		{
			if((spi >= 0) && (spi < p.length))
				p[spi] = sp;
		}
	}
	public void setAmmunition(int sammunition){ammunition = sammunition;}
	public void setFrequencyCap(long sfrequencyCap){frequencyCap = sfrequencyCap;}
}
